package com.lemo.action;

import com.lemo.model.User;
import com.lemo.service.UserService;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;
import java.util.Date;
import java.util.UUID;

/**
 * test
 *
 * @author 方宗庆
 * @create 2018-11-06 14:47
 */
@ParentPackage("basePackage")
@Action(value = "/")
@Namespace("/")
public class TestAction {

  @Autowired
  UserService userService;

  public String index() {
    return "success";
  }

  public void test() {
    System.out.println("进入testAction");
    userService.test();
  }

  public void saveUser() {
    User user = new User();
    user.setId(UUID.randomUUID().toString().replace("-", ""));
    user.setName("羊羊羊");
    user.setPwd("123456");
    user.setCreateDate(new Date());
    user.setModifyDate(new Date());
    Serializable save = userService.save(user);
  }
}